package com.lesent.model.enums;

/**
 * 异常枚举
 *
 */
public enum RestException {
    ;

    private final int code;

    private final String msg;

    RestException(int code,String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    RestException parseCode(int code){
        RestException[] restExceptions = RestException.values();
        for (RestException restException:restExceptions) {
            if(restException.code == code){
                return restException;
            }
        }
        return null;
    }
}
